package io.kiki.stack.netty.config.configs;

/**
 * the interface of a config container
 * <p>
 * Mainly used to manage config by user api, this is instance related, not globally.
 * That is to say, different remoting instance client or server hold different ConfigContainer.
 */
@Deprecated
public interface ConfigContainer {
    /**
     * check whether a config item of a certain config type exist.
     *
     * @param configType config types in the config container, different config type can hold the same config item key
     * @param configItem config items in the config container
     * @return exist then return true, not exist return false
     */
    boolean contains(ConfigType configType, ConfigItem configItem);

    /**
     * try to get config value using config type and config item.
     *
     * @param configType config types in the config container, different config type can hold the same config item key
     * @param configItem config items in the config container
     * @param <T>        the generics of return value
     * @return the right value and cast to type T, if no mappings, then return null
     */
    <T> T get(ConfigType configType, ConfigItem configItem);

    /**
     * init a config item with certain config type, and the value can be any type.
     * Notice: the value can be overwrite if you set more than once.
     *
     * @param configType config types in the config container, different config type can hold the same config item key
     * @param configItem config items in the config container
     */
    void set(ConfigType configType, ConfigItem configItem, Object value);
}